const handleInfos = {
    transfer: {
        name: '转移',
        type: 'transfer',
        icon: 'transfer'
    },
    transform: {
        name: '转化为客户',
        type: 'transform',
        icon: 'transform'
    },
    export: {
        name: '导出选中',
        type: 'export',
        icon: 'export'
    },
    delete: {
        name: '删除',
        type: 'delete',
        icon: 'delete'
    },
    put_seas: {
        name: '放入公海',
        type: 'put_seas',
        icon: 'seas'
    },
    lock: {
        name: '锁定',
        type: 'lock',
        icon: 'lock'
    },
    unlock: {
        name: '解锁',
        type: 'unlock',
        icon: 'unlock'
    },
    add_user: {
        name: '添加团队成员',
        type: 'add_user',
        icon: 'add'
    },
    delete_user: {
        name: '移除团队成员',
        type: 'delete_user',
        icon: 'remove'
    },
    alloc: {
        name: '分配',
        type: 'alloc',
        icon: 'alloc'
    },
    get: {
        name: '领取',
        type: 'get',
        icon: 'receive'
    },
    start: {
        name: '上架',
        type: 'start',
        icon: 'shelves'
    },
    disable: {
        name: '下架',
        type: 'disable',
        icon: 'sold-out'
    },
    deal_status: {
        name: '更改成交状态',
        type: 'deal_status',
        icon: 's-status'
    },
    reset_invoice_status: {
        name: '重置开票信息',
        type: 'reset_invoice_status',
        icon: 'reset'
    },
    update: {
        name: '编辑',
        type: 'update',
        icon: 'edit'
    }
}

function forSelectionHandleItems(handleInfos, array) {
    const tempsHandles = []
    for (let index = 0; index < array.length; index++) {
        tempsHandles.push(handleInfos[array[index]])
    }

    console.log("tempsHandles", tempsHandles)
    return tempsHandles
}

export function useSelectionItemHook() {

    function leadsSelectionItemHandle() {
        return forSelectionHandleItems(handleInfos, [
            'transfer',
            'transform',
            'export',
            'delete'
        ])
    }

    function customerSelectionItemHandle() {
        return forSelectionHandleItems(handleInfos, [
            'transfer',
            'put_seas',
            'deal_status',
            'export',
            'delete',
            'lock',
            'unlock',
            'add_user',
            'delete_user'
        ])
    }

    function contactsSelectionItemHandle() {
        return forSelectionHandleItems(handleInfos, [
            'transfer',
            'export',
            'delete',
            'add_user',
            'delete_user'
        ])
    }

    function businessSelectionItemHandle() {
        return forSelectionHandleItems(handleInfos, [
            'transfer',
            'export',
            'delete',
            'add_user',
            'delete_user'
        ])
    }

    function contractSelectionItemHandle() {
        return forSelectionHandleItems(handleInfos, [
            'transfer',
            'export',
            'delete',
            'add_user',
            'delete_user'
        ])
    }

    function receivablesSelectionItemHandle() {
        return forSelectionHandleItems(handleInfos, [
            'transfer',
            'export',
            'delete',
            'add_user',
            'delete_user'
        ])
    }

    function receivablesPlanSelectionItemHandle() {
        return forSelectionHandleItems(handleInfos, [
            'export',
            'update',
            'delete'
        ])
    }

    function productSelectionItemHandle() {
        return forSelectionHandleItems(handleInfos, [
            'transfer',
            'export',
            'delete',
            'start',
            'disable'
        ])
    }


    function visitSelectionItemHandle() {
        return forSelectionHandleItems(handleInfos, [
            'delete'
        ])
    }


    function invoiceSelectionItemHandle() {
        return forSelectionHandleItems(handleInfos, [
            'delete',
            'reset_invoice_status',
            'transfer'
        ])
    }


    return {
        leadsSelectionItemHandle,
        customerSelectionItemHandle,
        contactsSelectionItemHandle,
        contractSelectionItemHandle,
        businessSelectionItemHandle,
        receivablesSelectionItemHandle,
        receivablesPlanSelectionItemHandle,
        productSelectionItemHandle,
        visitSelectionItemHandle,
        invoiceSelectionItemHandle


    }
}



